package com.hy.hongying.controller;

import com.hy.hongying.bo.VideoMakesLikesBo;
import com.hy.hongying.config.SystemConfig;
import com.hy.hongying.service.intf.VideoLikeService;
import com.hy.hongying.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.ParameterResolutionDelegate;
import org.springframework.web.HttpMediaTypeException;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@CrossOrigin
@Api(tags = "用户点赞，视频的热门等等")
@RestController
@RequestMapping("/hy/VideoLikesController/")
public class VideoLikesController {
    @Autowired
    private VideoLikeService service;
    @ApiOperation("展示视频点赞以及用户人的状态")
    @PostMapping("getVideoLikesNums.do")
    public R getVideoLikesNums(Integer iid,Integer uid){
     return  service.videoHasLikesNums(iid,uid,SystemConfig.VIDEOLIKE_FLAG_1);
    }
    /*
    做了缓存的接口
     */
    @ApiOperation("用户视频点赞， 做了缓存的接口")
    @PostMapping("videoMakesLikes.do")
    public R videoMakesLikes(VideoMakesLikesBo bo, HttpServletRequest request){
        return  service.videoMakesLikes(bo,request.getHeader(SystemConfig.USER_TOKEN),SystemConfig.VIDEOLIKE_FLAG_1);
    }
    /*
    展示
     */
    @ApiOperation("展示评论点赞以及用户人的状态")
    @PostMapping("getCommintLikesNums.do")
    public R getCommintLikesNums(Integer cid,Integer uid){
        return  service.videoHasLikesNums(cid,uid,SystemConfig.VIDEOLIKE_FLAG_2);
    }
    @ApiOperation("用户评论点赞， 做了缓存的接口")
    @PostMapping("CommintMakesLikes.do")
    public R CommintMakesLikes(VideoMakesLikesBo bo, HttpServletRequest request){
        return  service.videoMakesLikes(bo,request.getHeader(SystemConfig.USER_TOKEN),SystemConfig.VIDEOLIKE_FLAG_2);
    }
}
